﻿<%@ Page Title="Parts - Purchases Order" Language="C#" MasterPageFile="~/Main.Master"
    AutoEventWireup="true" CodeBehind="CreatePO.aspx.cs" Inherits="VSM.Parts.CreatePO" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="../../../UC/ucBP.ascx" TagName="ucBP" TagPrefix="uc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">

        function OpenItemPopup() {
            var url = "../../../ItemPartPopup.aspx?itmgrp=102";
            Main.openCustomDialog(url, 600, 610, "Parts - Item Master Data");
        }

        function OpenBP() {
            var url = "../../../BPPopup.aspx?CardType=S";
            Main.openCustomDialog(url, 600, 610, "Business Partner List");
        }

        function OpenDocList(docktype) {
            var url = "../../../DocumentList.aspx?DocType=" + docktype
            Main.openCustomDialog(url, 800, 610, "Purchase Order List");
        }

        function OpenFCPO(docentry) {
            var url = "ForecastsPO.aspx?DocEntry=" + docentry
            Main.openCustomDialog(url, 800, 610, "Forecasts Purchase Order");
        }
        function OpenMain() {
            var docentry = $("#<%= txtPONo.ClientID %>").val();
            var dimensions = 'directories=no,titlebar=yes,toolbar=no,location=1,status=yes,menubar=no,scrollbars=yes,resizable=yes,height=620 ,width= 900 ';
            if (navigator.appName != "Microsoft Internet Explorer") {
                window.opener = self;
            }
            else {
                window.opener = true;
            }

            window.open('', '_self');
            var newWindow = window.open('../Reports/FormPrinting.aspx?DocEntry=' + docentry + '&DocType=22', '_blank', dimensions);
            if (isIE() == 8) {
                newWindow.location.href = '../Reports/FormPrinting.aspx?DocEntry=' + docentry + '&DocType=22'
            }
            window.moveTo(0, 0);
            window.resizeTo(screen.width, screen.height - 100);
        }
        function isIE() {
            var myNav = navigator.userAgent.toLowerCase();
            return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false;
        }
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server">
            <ContentTemplate>
                <asp:HiddenField ID="hdnIsUpdate" runat="server" />
                <asp:HiddenField ID="hdnStatus" runat="server" />
                <asp:HiddenField ID="hdnIsCreatedSO" runat="server" />
                <asp:HiddenField ID="hdnIsLoadData" runat="server" />
                <h2>
                    &nbsp;<asp:Label ID="lblTitle" runat="server" Text="Parts - Purchase Order"></asp:Label>
                </h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                    <table border="0" width="100%" style="background-color: #D1D4D8; font-weight: bold;">
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                PO No.:
                            </td>
                            <td>
                                <asp:TextBox ID="txtPONo" runat="server" BackColor="#E6E6E6" ReadOnly="True" Width="100px"></asp:TextBox>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; width: 120px;">
                                Status:
                            </td>
                            <td align="left">
                                <asp:Label ID="lblStatus" runat="server" Text="Open" ForeColor="Red"></asp:Label>
                            </td>
                            <td align="right">
                                <asp:Button ID="btnGetImportTemplate" runat="server" Height="26px" OnClick="btnGetImportTemplate_Click"
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;"
                                    Text="Get Import Template" Width="150px" />
                                <asp:Button ID="btnDocList" runat="server" OnClientClick="OpenDocList('22'); return false;"
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;"
                                    Text="List" Width="60px" />
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom; width: 100px;">
                                Posting Date:
                            </td>
                            <td style="width: 150px">
                                <asp:TextBox ID="txtPostingDate" runat="server" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="txtPostingDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                    PopupButtonID="imgPostingDate" TargetControlID="txtPostingDate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgPostingDate" runat="Server" AlternateText="Click to show calendar"
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <asp:Label ID="lblPosDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                PO Type:
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlPOType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPOType_SelectedIndexChanged">
                                    <asp:ListItem Value="0">mO</asp:ListItem>
                                    <asp:ListItem Value="1">eO</asp:ListItem>
                                    <asp:ListItem Value="2">DO</asp:ListItem>
                                    <asp:ListItem Value="3">Special</asp:ListItem>
                                    <asp:ListItem Value="4">Special 1</asp:ListItem>
                                    <asp:ListItem Value="5">Special 2</asp:ListItem>
                                </asp:DropDownList>
                                <asp:DropDownList ID="ddlVSMPOType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlVSMPOType_SelectedIndexChanged">
                                    <asp:ListItem Value="7">Sea</asp:ListItem>
                                    <asp:ListItem Value="8">Air</asp:ListItem>
                                    <asp:ListItem Value="9">VOR</asp:ListItem>
                                    <asp:ListItem Value="10">Initial Stock</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                Delivery Date:
                            </td>
                            <td valign="top">
                                <asp:TextBox ID="txtDelDate" runat="server" Width="100px"></asp:TextBox>
                                <asp:ImageButton ID="imgDeldate" runat="Server" AlternateText="Click to show calendar"
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtDelDate"
                                    PopupButtonID="imgDeldate" Format="dd/MM/yyyy">
                                </cc1:CalendarExtender>
                                <asp:Label ID="lblDelDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                <asp:RadioButton ID="radPO" runat="server" Checked="True" ForeColor="Blue" GroupName="POType"
                                    Text="Purchase Order" />
                            </td>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                <asp:RadioButton ID="radSQRequest" runat="server" ForeColor="Blue" GroupName="POType"
                                    Text="Sales Quotation Request" />
                                <asp:DropDownList ID="ddlAppStatus" runat="server" Enabled="False" Visible="False">
                                    <asp:ListItem Value="0">New</asp:ListItem>
                                    <asp:ListItem Value="1">Approved</asp:ListItem>
                                    <asp:ListItem Value="2">Rejected</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                Doc. Date:
                            </td>
                            <td>
                                <asp:TextBox ID="txtPODate" runat="server" AutoPostBack="True" Width="100px"></asp:TextBox>
                                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" Format="dd/MM/yyyy" PopupButtonID="imgPODate"
                                    TargetControlID="txtPODate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgPODate" runat="Server" AlternateText="Click to show calendar"
                                    ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                <asp:Label ID="lblDocDateRequired" runat="server" ForeColor="Red" Text="*"></asp:Label>
                            </td>
                            <td colspan="3">
                                <asp:Panel ID="Panel1" runat="server" Width="100%">
                                    <table style="width: 70%;">
                                        <tr>
                                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                                Deposit:
                                            </td>
                                            <td>
                                                <asp:Label ID="lblDeposit" runat="server" ForeColor="Red"></asp:Label>
                                            </td>
                                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                                Limit:
                                            </td>
                                            <td>
                                                <asp:Label ID="lblLimit" runat="server" ForeColor="Red"></asp:Label>
                                            </td>
                                            <td style="border-bottom: dotted 1px #808080; vertical-align: bottom;">
                                                Open Retail Sales Invoice:
                                            </td>
                                            <td>
                                                <asp:Label ID="lblPer" runat="server" ForeColor="Red"></asp:Label>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                            </td>
                        </tr>
                    </table>
                    <table id="Table1" width="100%" style="font-weight: bold">
                        <tr>
                            <td class="FormLineItemAlt" colspan="2">
                                <uc1:ucBP ID="ucBP1" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem" valign="middle" style="border-bottom: dotted 1px #808080;
                                vertical-align: bottom; width: 93px;">
                                <asp:Label ID="lblConPersonName" runat="server">Contact Person:</asp:Label>
                            </td>
                            <td class="FormLineItem">
                                <asp:TextBox ID="txtConpersonName" runat="server" Width="750px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItemAlt" valign="middle" colspan="2">
                                <asp:Button ID="btnAddItems" runat="server" OnClick="btnAddItems_Click" OnClientClick="OpenItemPopup(); return false;"
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;"
                                    Text="Add new item" Width="110px" />
                                <asp:FileUpload ID="FileUploadControl" runat="server" Width="400px" />
                                <asp:Button ID="btnImport" runat="server" OnClick="btnImport_Click" Text="Import"
                                    Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;"
                                    Width="60px" />
                                <asp:Button ID="btnForecast" runat="server" Style="background-image: url('/Images/bgButton.png');
                                    background-repeat: no-repeat;" Text="Forecast PO" Width="90px" OnClick="btnForecast_Click"
                                    Visible="False" />
                            </td>
                        </tr>
                        <tr>
                            <td align="left" style="border-bottom: dotted 1px #808080; vertical-align: bottom;"
                                colspan="2">
                                ItemCode :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <asp:TextBox ID="txtItemCode" runat="server" OnTextChanged="txtItemCode_TextChanged"
                                    Width="170px" AutoPostBack="true"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                    <hr />
                    <div style="width: 100%">
                        <asp:GridView ID="grvPO" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                            BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                            HeaderStyle-Height="27px" OnRowCreated="grvPO_RowCreated" CellSpacing="2" HeaderStyle-VerticalAlign="Middle"
                            AllowPaging="True" OnPageIndexChanging="grvSearchResult_PageIndexChanging" PageSize="20"
                            OnRowDataBound="grvSearchResult_RowDataBound">
                            <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                            <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                            <Columns>
                                <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                    Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    ItemStyle-Width="70px" />
                                <asp:TemplateField HeaderText="Action">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete" TabIndex="-1" OnClick="lnkDelete_Click"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="#">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblNo" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">
                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Item Code">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblItemCode" runat="server" Text='<%# Bind("ItemCode") %>'></asp:Label>
                                        <asp:HiddenField ID="hdnVatGroup" runat="server" Value='<%# Bind("Taxcode") %>'>
                                        </asp:HiddenField>
                                        <asp:HiddenField ID="hdnLineNum" runat="server" Value='<%# Bind("LineNum") %>'></asp:HiddenField>
                                        <asp:HiddenField ID="hdnRate" runat="server" Value='<%# Bind("VatPrcnt") %>'></asp:HiddenField>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Item Name">
                                    <ItemStyle HorizontalAlign="left" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" Width="300px" />
                                    <HeaderTemplate>
                                        <asp:Label ID="lblHeaderItemName" runat="Server" Text="Item Name" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="lblItemName" runat="server" Text='<%# Bind("Dscription") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                     <asp:TemplateField HeaderText="UoM">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtUoM" runat="server" Text='<%# Bind("unitMsr") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Model">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" Width="60px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblModel" runat="server" Text='<%# Bind("U_Model") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Product" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblProduct" runat="server" Text='<%# Bind("U_Product") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Color" Visible="false">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblColor" runat="server" Text='<%# Bind("U_Color") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Qty.">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="40px" />
                                    <HeaderTemplate>
                                        <asp:Label ID="lblHeaderQty" runat="Server" Text="Qty." />
                                        <asp:Label ID="lblQtyRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtOrderQuantity" runat="server" Width="97%" Text='<%# Bind("Quantity") %>'
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" Style="text-align: right"
                                            OnTextChanged="txtOrderQuantity_OnTextChanged" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Unit Price">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <HeaderTemplate>
                                        <asp:Label ID="lblHeaderDiscount" runat="Server" Text="Unit Price" />
                                        <asp:Label ID="lblDiscountRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtUnitPrice" Style="text-align: right" Width="97%" runat="server"
                                            Text='<%# Bind("PriceBefDi") %>' AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);"
                                            OnTextChanged="txtUnitPrice_OnTextChanged" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Discount (%)">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="60px" />
                                    <HeaderTemplate>
                                        <asp:Label ID="lblHeaderDiscount" runat="Server" Text="Discount (%)" />
                                        <asp:Label ID="lblDiscountRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtDiscPrcnt" runat="server" Width="96%" Style="text-align: right"
                                            Text='<%# Bind("DiscPrcnt") %>' AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);"
                                            OnTextChanged="txtDiscount_OnTextChanged" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ETD">
                                    <HeaderStyle VerticalAlign="Middle" Width="95px" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderTemplate>
                                        <asp:Label ID="lblHeaderETD" runat="Server" Text="ETD" />
                                        <asp:Label ID="lblHeaderETDRequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtETD" Style="width: 75%;" runat="server" Text='<%# Bind("U_ETD", "{0:dd/MM/yyyy}")%>'
                                            OnTextChanged="txtETD_OnTextChanged" AutoPostBack="true" />
                                        <asp:ImageButton ID="imgETD" runat="Server" AlternateText="Click to show calendar"
                                            ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                        <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtETD"
                                            PopupButtonID="imgETD" Format="dd/MM/yyyy">
                                        </cc1:CalendarExtender>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ETA">
                                    <HeaderStyle VerticalAlign="Middle" Width="95px" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderTemplate>
                                        <asp:Label ID="lblHeaderETA" runat="Server" Text="ETA" />
                                        <asp:Label ID="lblHeaderETARequired" runat="server" Font-Bold="true" Text="*" ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtETA" Style="width: 75%;" runat="server" Text='<%# Bind("U_ETA", "{0:dd/MM/yyyy}")%>'
                                            OnTextChanged="txtETA_OnTextChanged" AutoPostBack="true" />
                                        <asp:ImageButton ID="imgETA" runat="Server" AlternateText="Click to show calendar"
                                            ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                        <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtETA"
                                            PopupButtonID="imgETA" Format="dd/MM/yyyy">
                                        </cc1:CalendarExtender>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Due Date">
                                    <HeaderStyle VerticalAlign="Middle" Width="95px" />
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderTemplate>
                                        <asp:Label ID="lblHeaderDueDate" runat="Server" Text="Due Date" />
                                        <asp:Label ID="lblHeaderDueDateRequired" runat="server" Font-Bold="true" Text="*"
                                            ForeColor="Red" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:TextBox ID="txtDueDate" Style="width: 75%;" runat="server" Text='<%# Bind("U_DueDate", "{0:dd/MM/yyyy}")%>'
                                            OnTextChanged="txtDueDate_OnTextChanged" AutoPostBack="true" />
                                        <asp:ImageButton ID="imgDueDate" runat="Server" AlternateText="Click to show calendar"
                                            ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                        <cc1:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="txtDueDate"
                                            PopupButtonID="imgDueDate" Format="dd/MM/yyyy">
                                        </cc1:CalendarExtender>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Warehouse" Visible="false">
                                    <ItemStyle HorizontalAlign="Center" Width="80px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:DropDownList ID="ddlWhs" AutoPostBack="true" OnSelectedIndexChanged="ddlWhs_SelectedIndexChanged"
                                            Style="width: 98%;" runat="server" />
                                        <asp:HiddenField ID="hdnWhsCode" Value='<%# Bind("WhsCode") %>' runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Price After Disc" Visible="false">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="100px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lblPrice" Style="text-align: right" runat="server" Text='<%# Bind("Price") %>'
                                            BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Line Total">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="120px" />
                                    <ItemTemplate>
                                        <asp:Label ID="txtLineTotal" runat="server" Text='<%# Bind("LineTotal") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="VSM Available">
                                    <ItemStyle HorizontalAlign="Center" />
                                    <HeaderStyle VerticalAlign="Middle" Width="50px" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lblVSMAvailable" runat="server" Text='<%# Bind("Available") %>'
                                            BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <HeaderStyle BackColor="#6095C9" ForeColor="#ffffff" Font-Overline="False" Height="27px"
                                VerticalAlign="Middle" HorizontalAlign="Center" />
                            <EmptyDataTemplate>
                                <table class="GridInner" style="width: 100%; border-color: White;" border="1" rules="all"
                                    cellspacing="2" cellpadding="2">
                                    <tr valign="middle" style="height: 27px; color: white; text-decoration: none; background-color: rgb(96, 149, 201);
                                        text-align: center;">
                                        <th>
                                            <span>Action</span>
                                        </th>
                                        <th>
                                            <span>#</span>
                                        </th>
                                        <th>
                                            <span>Item Code</span>
                                        </th>
                                        <th>
                                            <span>Item Name</span>
                                        </th>
                                        <th>
                                            <span>Model</span>
                                        </th>
                                        <th>
                                            <span>Order Qty.</span>
                                        </th>
                                        <th>
                                            <span>Unit Price</span>
                                        </th>
                                        <th>
                                            <span>Discount (%)</span>
                                        </th>
                                        <th>
                                            <span>ETD</span>
                                        </th>
                                        <th>
                                            <span>ETA</span>
                                        </th>
                                        <th>
                                            <span>Due Date</span>
                                        </th>
                                        <%--  <th>
                                            <span>Warehouse</span>
                                        </th>--%>
                                        <th>
                                            <span>Line Total</span>
                                        </th>
                                        <th>
                                            <span>VSM Available</span>
                                        </th>
                                    </tr>
                                    <tr>
                                        <td colspan="14">
                                            <span>No Data</span>
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                        </asp:GridView>
                    </div>
                    <hr width="100%" />
                </div>
                <table width="100%" border="0">
                    <tr>
                        <td valign="top" style="width: 70%">
                            <table style="width: 100%;">
                                <tr>
                                    <td style="width: 10%;">
                                        <strong>Remarks :</strong>
                                    </td>
                                    <td style="width: 50%;">
                                        <asp:TextBox runat="server" Style="width: 98%;" ID="txtRemarks" Height="71px" TextMode="MultiLine"></asp:TextBox>
                                    </td>
                                    <td style="width: 10%;">
                                        <strong>Buyer:</strong>
                                    </td>
                                    <td style="width: 30%;">
                                        <asp:DropDownList ID="ddlBuyer" Style="width: 100%;" runat="server">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td style="width: 30%" align="right">
                            <div style="margin-right: 5px;">
                                <table border="0">
                                    <tr valign="middle" style="height: 27px; color: black; font-weight: bold; text-decoration: none;
                                        background-color: #D9E0ED;">
                                        <td align="right">
                                            Sub Total:
                                        </td>
                                        <td style="width: 150px" align="right">
                                            <asp:Label ID="lblSubTotal" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; color: white; font-weight: bold; text-decoration: none;
                                        background-color: rgb(96, 149, 201);">
                                        <td align="right">
                                            Tax Amount:
                                        </td>
                                        <td style="width: 150px" align="right">
                                            <asp:Label ID="lblTaxAmount" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr valign="middle" style="height: 27px; font-weight: bold; text-decoration: none;
                                        background-color: #D9E0ED;">
                                        <td style="width: 150px" align="right">
                                            Grand Total:
                                        </td>
                                        <td align="right">
                                            <asp:Label ID="lblDocumentTotal" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div style="margin-left: 5px; width: 99%;">
                                <hr />
                            </div>
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 400px;">
                                        <asp:Button ID="btnSave" runat="server" Text="Save" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnSave_Click" BorderStyle="Solid"
                                            Width="60px" />
                                        <asp:Button ID="btnCancel" runat="server" Text="Cancel" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnCancel_Click" BorderStyle="Solid"
                                            Width="60px" />
                                        <asp:Button ID="btnApprove" runat="server" Text="Approve" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" OnClick="btnApprove_Click" BorderStyle="Solid"
                                            Enabled="False" Width="60px" Visible="False" />
                                        <asp:Button ID="btnReject" runat="server" BorderStyle="Solid" Enabled="False" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" Text="Reject" Width="60px" OnClick="btnReject_Click"
                                            Visible="False" />
                                        <asp:Button ID="btnPrint" runat="server" BorderStyle="Solid" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" Text="Print" Width="60px" OnClick="btnPrint_Click" />
                                        <asp:Button ID="btnClear" runat="server" BorderStyle="Solid" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" Text="Clear" Width="60px" OnClick="btnClear_Click" />
                                        <asp:Button ID="btnLastRecord" runat="server" BorderStyle="Solid" OnClick="btnLastRecord_Click"
                                            Style="background-image: url('/Images/bgButton.png'); background-repeat: no-repeat;
                                            color: White;" Text="&gt;&gt;" ToolTip="Last record" Width="40px" />
                                    </td>
                                    <td>
                                        <asp:Label ID="lblError" runat="server" Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                    <td align="right" style="width: 240px;">
                                        <asp:Button ID="btnCopyToGRPO" runat="server" Text="Copy to GRPO." Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" BorderStyle="Solid" OnClick="btnCopyToGRPO_Click"
                                            Width="110px" />
                                        <asp:Button ID="btnCopyToAPInvoice" runat="server" Text="Copy to A/P Invoice" Style="background-image: url('/Images/bgButton.png');
                                            background-repeat: no-repeat; color: White;" BorderStyle="Solid" OnClick="btnCopyToAPInvoice_Click"
                                            Width="120px" />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3">
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger ControlID="btnImport" />
                <asp:PostBackTrigger ControlID="btnGetImportTemplate" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
